Debian12安装nvidia-container-runtime
Installing with Apt
- Configure the production repository:
bash
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
&& curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
Optionally, configure the repository to use experimental packages:
bash
sed -i -e '/experimental/ s/^#//g' /etc/apt/sources.list.d/nvidia-container-toolkit.list
- Update the packages list from the repository:
bash
sudo apt-get update
- Install the NVIDIA Container Toolkit packages:
bash
sudo apt-get install -y nvidia-container-toolkit
Configuring Docker
- Configure the container runtime by using the
nvidia-ctk
command:
bash
sudo nvidia-ctk runtime configure --runtime=docker
The nvidia-ctk
command modifies the /etc/docker/daemon.json
file on the host. The file is updated so that Docker can use the NVIDIA Container Runtime.
- Restart the Docker daemon:
bash
sudo systemctl restart docker